<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - code analysis - /usr/include/google/protobuf/generated_message_reflection.h</title>
  <link rel="stylesheet" type="text/css" href="../../../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../../../../index.html">top level</a> - <a href="index.html">usr/include/google/protobuf</a> - generated_message_reflection.h<span style="font-size: 80%;"> (source / <a href="generated_message_reflection.h.func-sort-c.html">functions</a>)</span></td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">code analysis</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntry">1</td>
            <td class="headerCovTableEntryLo">0.0 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2020-09-11 22:50:33</td>
            <td></td>
            <td class="headerItem">Functions:</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntryHi">-</td>
          </tr>
          <tr>
            <td class="headerItem">Legend:</td>
            <td class="headerValueLeg">            Lines:
            <span class="coverLegendCov">hit</span>
            <span class="coverLegendNoCov">not hit</span>
</td>
            <td></td>
          </tr>
          <tr><td><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">          Line data    Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum">       1 </span>            : // Protocol Buffers - Google's data interchange format</a>
<span class="lineNum">       2 </span>            : // Copyright 2008 Google Inc.  All rights reserved.
<span class="lineNum">       3 </span>            : // https://developers.google.com/protocol-buffers/
<span class="lineNum">       4 </span>            : //
<span class="lineNum">       5 </span>            : // Redistribution and use in source and binary forms, with or without
<span class="lineNum">       6 </span>            : // modification, are permitted provided that the following conditions are
<span class="lineNum">       7 </span>            : // met:
<span class="lineNum">       8 </span>            : //
<span class="lineNum">       9 </span>            : //     * Redistributions of source code must retain the above copyright
<span class="lineNum">      10 </span>            : // notice, this list of conditions and the following disclaimer.
<span class="lineNum">      11 </span>            : //     * Redistributions in binary form must reproduce the above
<span class="lineNum">      12 </span>            : // copyright notice, this list of conditions and the following disclaimer
<span class="lineNum">      13 </span>            : // in the documentation and/or other materials provided with the
<span class="lineNum">      14 </span>            : // distribution.
<span class="lineNum">      15 </span>            : //     * Neither the name of Google Inc. nor the names of its
<span class="lineNum">      16 </span>            : // contributors may be used to endorse or promote products derived from
<span class="lineNum">      17 </span>            : // this software without specific prior written permission.
<span class="lineNum">      18 </span>            : //
<span class="lineNum">      19 </span>            : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
<span class="lineNum">      20 </span>            : // &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
<span class="lineNum">      21 </span>            : // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
<span class="lineNum">      22 </span>            : // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
<span class="lineNum">      23 </span>            : // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
<span class="lineNum">      24 </span>            : // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
<span class="lineNum">      25 </span>            : // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
<span class="lineNum">      26 </span>            : // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
<span class="lineNum">      27 </span>            : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
<span class="lineNum">      28 </span>            : // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
<span class="lineNum">      29 </span>            : // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<span class="lineNum">      30 </span>            : 
<span class="lineNum">      31 </span>            : // Author: kenton@google.com (Kenton Varda)
<span class="lineNum">      32 </span>            : //  Based on original Protocol Buffers design by
<span class="lineNum">      33 </span>            : //  Sanjay Ghemawat, Jeff Dean, and others.
<span class="lineNum">      34 </span>            : //
<span class="lineNum">      35 </span>            : // This header is logically internal, but is made public because it is used
<span class="lineNum">      36 </span>            : // from protocol-compiler-generated code, which may reside in other components.
<span class="lineNum">      37 </span>            : 
<span class="lineNum">      38 </span>            : #ifndef GOOGLE_PROTOBUF_GENERATED_MESSAGE_REFLECTION_H__
<span class="lineNum">      39 </span>            : #define GOOGLE_PROTOBUF_GENERATED_MESSAGE_REFLECTION_H__
<span class="lineNum">      40 </span>            : 
<span class="lineNum">      41 </span>            : #include &lt;string&gt;
<span class="lineNum">      42 </span>            : #include &lt;vector&gt;
<span class="lineNum">      43 </span>            : #include &lt;google/protobuf/stubs/common.h&gt;
<span class="lineNum">      44 </span>            : // TODO(jasonh): Remove this once the compiler change to directly include this
<span class="lineNum">      45 </span>            : // is released to components.
<span class="lineNum">      46 </span>            : #include &lt;google/protobuf/generated_enum_reflection.h&gt;
<span class="lineNum">      47 </span>            : #include &lt;google/protobuf/message.h&gt;
<span class="lineNum">      48 </span>            : #include &lt;google/protobuf/unknown_field_set.h&gt;
<span class="lineNum">      49 </span>            : 
<span class="lineNum">      50 </span>            : 
<span class="lineNum">      51 </span>            : namespace google {
<span class="lineNum">      52 </span>            : namespace upb {
<span class="lineNum">      53 </span>            : namespace google_opensource {
<span class="lineNum">      54 </span>            : class GMR_Handlers;
<span class="lineNum">      55 </span>            : }  // namespace google_opensource
<span class="lineNum">      56 </span>            : }  // namespace upb
<span class="lineNum">      57 </span>            : 
<span class="lineNum">      58 </span>            : namespace protobuf {
<span class="lineNum">      59 </span>            :   class DescriptorPool;
<span class="lineNum">      60 </span>            : }
<span class="lineNum">      61 </span>            : 
<span class="lineNum">      62 </span>            : namespace protobuf {
<span class="lineNum">      63 </span>            : namespace internal {
<span class="lineNum">      64 </span>            : class DefaultEmptyOneof;
<span class="lineNum">      65 </span>            : 
<span class="lineNum">      66 </span>            : // Defined in this file.
<span class="lineNum">      67 </span>            : class GeneratedMessageReflection;
<span class="lineNum">      68 </span>            : 
<span class="lineNum">      69 </span>            : // Defined in other files.
<span class="lineNum">      70 </span>            : class ExtensionSet;             // extension_set.h
<span class="lineNum">      71 </span>            : 
<span class="lineNum">      72 </span>            : // THIS CLASS IS NOT INTENDED FOR DIRECT USE.  It is intended for use
<span class="lineNum">      73 </span>            : // by generated code.  This class is just a big hack that reduces code
<span class="lineNum">      74 </span>            : // size.
<span class="lineNum">      75 </span>            : //
<span class="lineNum">      76 </span>            : // A GeneratedMessageReflection is an implementation of Reflection
<span class="lineNum">      77 </span>            : // which expects all fields to be backed by simple variables located in
<span class="lineNum">      78 </span>            : // memory.  The locations are given using a base pointer and a set of
<span class="lineNum">      79 </span>            : // offsets.
<span class="lineNum">      80 </span>            : //
<span class="lineNum">      81 </span>            : // It is required that the user represents fields of each type in a standard
<span class="lineNum">      82 </span>            : // way, so that GeneratedMessageReflection can cast the void* pointer to
<span class="lineNum">      83 </span>            : // the appropriate type.  For primitive fields and string fields, each field
<span class="lineNum">      84 </span>            : // should be represented using the obvious C++ primitive type.  Enums and
<span class="lineNum">      85 </span>            : // Messages are different:
<span class="lineNum">      86 </span>            : //  - Singular Message fields are stored as a pointer to a Message.  These
<span class="lineNum">      87 </span>            : //    should start out NULL, except for in the default instance where they
<span class="lineNum">      88 </span>            : //    should start out pointing to other default instances.
<span class="lineNum">      89 </span>            : //  - Enum fields are stored as an int.  This int must always contain
<span class="lineNum">      90 </span>            : //    a valid value, such that EnumDescriptor::FindValueByNumber() would
<span class="lineNum">      91 </span>            : //    not return NULL.
<span class="lineNum">      92 </span>            : //  - Repeated fields are stored as RepeatedFields or RepeatedPtrFields
<span class="lineNum">      93 </span>            : //    of whatever type the individual field would be.  Strings and
<span class="lineNum">      94 </span>            : //    Messages use RepeatedPtrFields while everything else uses
<span class="lineNum">      95 </span>            : //    RepeatedFields.
<span class="lineNum">      96 </span>            : class LIBPROTOBUF_EXPORT GeneratedMessageReflection : public Reflection {
<span class="lineNum">      97 </span>            :  public:
<span class="lineNum">      98 </span>            :   // Constructs a GeneratedMessageReflection.
<span class="lineNum">      99 </span>            :   // Parameters:
<span class="lineNum">     100 </span>            :   //   descriptor:    The descriptor for the message type being implemented.
<span class="lineNum">     101 </span>            :   //   default_instance:  The default instance of the message.  This is only
<span class="lineNum">     102 </span>            :   //                  used to obtain pointers to default instances of embedded
<span class="lineNum">     103 </span>            :   //                  messages, which GetMessage() will return if the particular
<span class="lineNum">     104 </span>            :   //                  sub-message has not been initialized yet.  (Thus, all
<span class="lineNum">     105 </span>            :   //                  embedded message fields *must* have non-NULL pointers
<span class="lineNum">     106 </span>            :   //                  in the default instance.)
<span class="lineNum">     107 </span>            :   //   offsets:       An array of ints giving the byte offsets, relative to
<span class="lineNum">     108 </span>            :   //                  the start of the message object, of each field.  These can
<span class="lineNum">     109 </span>            :   //                  be computed at compile time using the
<span class="lineNum">     110 </span>            :   //                  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET() macro, defined
<span class="lineNum">     111 </span>            :   //                  below.
<span class="lineNum">     112 </span>            :   //   has_bits_offset:  Offset in the message of an array of uint32s of size
<span class="lineNum">     113 </span>            :   //                  descriptor-&gt;field_count()/32, rounded up.  This is a
<span class="lineNum">     114 </span>            :   //                  bitfield where each bit indicates whether or not the
<span class="lineNum">     115 </span>            :   //                  corresponding field of the message has been initialized.
<span class="lineNum">     116 </span>            :   //                  The bit for field index i is obtained by the expression:
<span class="lineNum">     117 </span>            :   //                    has_bits[i / 32] &amp; (1 &lt;&lt; (i % 32))
<span class="lineNum">     118 </span>            :   //   unknown_fields_offset:  Offset in the message of the UnknownFieldSet for
<span class="lineNum">     119 </span>            :   //                  the message.
<span class="lineNum">     120 </span>            :   //   extensions_offset:  Offset in the message of the ExtensionSet for the
<span class="lineNum">     121 </span>            :   //                  message, or -1 if the message type has no extension
<span class="lineNum">     122 </span>            :   //                  ranges.
<span class="lineNum">     123 </span>            :   //   pool:          DescriptorPool to search for extension definitions.  Only
<span class="lineNum">     124 </span>            :   //                  used by FindKnownExtensionByName() and
<span class="lineNum">     125 </span>            :   //                  FindKnownExtensionByNumber().
<span class="lineNum">     126 </span>            :   //   factory:       MessageFactory to use to construct extension messages.
<span class="lineNum">     127 </span>            :   //   object_size:   The size of a message object of this type, as measured
<span class="lineNum">     128 </span>            :   //                  by sizeof().
<span class="lineNum">     129 </span>            :   GeneratedMessageReflection(const Descriptor* descriptor,
<span class="lineNum">     130 </span>            :                              const Message* default_instance,
<span class="lineNum">     131 </span>            :                              const int offsets[],
<span class="lineNum">     132 </span>            :                              int has_bits_offset,
<span class="lineNum">     133 </span>            :                              int unknown_fields_offset,
<span class="lineNum">     134 </span>            :                              int extensions_offset,
<span class="lineNum">     135 </span>            :                              const DescriptorPool* pool,
<span class="lineNum">     136 </span>            :                              MessageFactory* factory,
<span class="lineNum">     137 </span>            :                              int object_size);
<span class="lineNum">     138 </span>            : 
<span class="lineNum">     139 </span>            :   // Similar with the construction above. Call this construction if the
<span class="lineNum">     140 </span>            :   // message has oneof definition.
<span class="lineNum">     141 </span>            :   // Parameters:
<span class="lineNum">     142 </span>            :   //   offsets:       An array of ints giving the byte offsets.
<span class="lineNum">     143 </span>            :   //                  For each oneof field, the offset is relative to the
<span class="lineNum">     144 </span>            :   //                  default_oneof_instance. These can be computed at compile
<span class="lineNum">     145 </span>            :   //                  time using the
<span class="lineNum">     146 </span>            :   //                  PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET() macro.
<span class="lineNum">     147 </span>            :   //                  For each none oneof field, the offset is related to
<span class="lineNum">     148 </span>            :   //                  the start of the message object.  These can be computed
<span class="lineNum">     149 </span>            :   //                  at compile time using the
<span class="lineNum">     150 </span>            :   //                  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET() macro.
<span class="lineNum">     151 </span>            :   //                  Besides offsets for all fields, this array also contains
<span class="lineNum">     152 </span>            :   //                  offsets for oneof unions. The offset of the i-th oneof
<span class="lineNum">     153 </span>            :   //                  union is offsets[descriptor-&gt;field_count() + i].
<span class="lineNum">     154 </span>            :   //   default_oneof_instance: The default instance of the oneofs. It is a
<span class="lineNum">     155 </span>            :   //                  struct holding the default value of all oneof fields
<span class="lineNum">     156 </span>            :   //                  for this message. It is only used to obtain pointers
<span class="lineNum">     157 </span>            :   //                  to default instances of oneof fields, which Get
<span class="lineNum">     158 </span>            :   //                  methods will return if the field is not set.
<span class="lineNum">     159 </span>            :   //   oneof_case_offset:  Offset in the message of an array of uint32s of
<span class="lineNum">     160 </span>            :   //                  size descriptor-&gt;oneof_decl_count().  Each uint32
<span class="lineNum">     161 </span>            :   //                  indicates what field is set for each oneof.
<span class="lineNum">     162 </span>            :   //   other parameters are the same with the construction above.
<span class="lineNum">     163 </span>            :   GeneratedMessageReflection(const Descriptor* descriptor,
<span class="lineNum">     164 </span>            :                              const Message* default_instance,
<span class="lineNum">     165 </span>            :                              const int offsets[],
<span class="lineNum">     166 </span>            :                              int has_bits_offset,
<span class="lineNum">     167 </span>            :                              int unknown_fields_offset,
<span class="lineNum">     168 </span>            :                              int extensions_offset,
<span class="lineNum">     169 </span>            :                              const void* default_oneof_instance,
<span class="lineNum">     170 </span>            :                              int oneof_case_offset,
<span class="lineNum">     171 </span>            :                              const DescriptorPool* pool,
<span class="lineNum">     172 </span>            :                              MessageFactory* factory,
<span class="lineNum">     173 </span>            :                              int object_size);
<span class="lineNum">     174 </span>            :   ~GeneratedMessageReflection();
<span class="lineNum">     175 </span>            : 
<span class="lineNum">     176 </span>            :   // implements Reflection -------------------------------------------
<span class="lineNum">     177 </span>            : 
<span class="lineNum">     178 </span>            :   const UnknownFieldSet&amp; GetUnknownFields(const Message&amp; message) const;
<span class="lineNum">     179 </span>            :   UnknownFieldSet* MutableUnknownFields(Message* message) const;
<span class="lineNum">     180 </span>            : 
<span class="lineNum">     181 </span>            :   int SpaceUsed(const Message&amp; message) const;
<span class="lineNum">     182 </span>            : 
<span class="lineNum">     183 </span>            :   bool HasField(const Message&amp; message, const FieldDescriptor* field) const;
<span class="lineNum">     184 </span>            :   int FieldSize(const Message&amp; message, const FieldDescriptor* field) const;
<span class="lineNum">     185 </span>            :   void ClearField(Message* message, const FieldDescriptor* field) const;
<span class="lineNum">     186 </span>            :   bool HasOneof(const Message&amp; message,
<span class="lineNum">     187 </span>            :                 const OneofDescriptor* oneof_descriptor) const;
<span class="lineNum">     188 </span>            :   void ClearOneof(Message* message, const OneofDescriptor* field) const;
<span class="lineNum">     189 </span>            :   void RemoveLast(Message* message, const FieldDescriptor* field) const;
<span class="lineNum">     190 </span>            :   Message* ReleaseLast(Message* message, const FieldDescriptor* field) const;
<span class="lineNum">     191 </span>            :   void Swap(Message* message1, Message* message2) const;
<span class="lineNum">     192 </span>            :   void SwapFields(Message* message1, Message* message2,
<span class="lineNum">     193 </span>            :                   const vector&lt;const FieldDescriptor*&gt;&amp; fields) const;
<span class="lineNum">     194 </span>            :   void SwapElements(Message* message, const FieldDescriptor* field,
<span class="lineNum">     195 </span>            :                     int index1, int index2) const;
<span class="lineNum">     196 </span>            :   void ListFields(const Message&amp; message,
<span class="lineNum">     197 </span>            :                   vector&lt;const FieldDescriptor*&gt;* output) const;
<span class="lineNum">     198 </span>            : 
<span class="lineNum">     199 </span>            :   int32  GetInt32 (const Message&amp; message,
<span class="lineNum">     200 </span>            :                    const FieldDescriptor* field) const;
<span class="lineNum">     201 </span>            :   int64  GetInt64 (const Message&amp; message,
<span class="lineNum">     202 </span>            :                    const FieldDescriptor* field) const;
<span class="lineNum">     203 </span>            :   uint32 GetUInt32(const Message&amp; message,
<span class="lineNum">     204 </span>            :                    const FieldDescriptor* field) const;
<span class="lineNum">     205 </span>            :   uint64 GetUInt64(const Message&amp; message,
<span class="lineNum">     206 </span>            :                    const FieldDescriptor* field) const;
<span class="lineNum">     207 </span>            :   float  GetFloat (const Message&amp; message,
<span class="lineNum">     208 </span>            :                    const FieldDescriptor* field) const;
<span class="lineNum">     209 </span>            :   double GetDouble(const Message&amp; message,
<span class="lineNum">     210 </span>            :                    const FieldDescriptor* field) const;
<span class="lineNum">     211 </span>            :   bool   GetBool  (const Message&amp; message,
<span class="lineNum">     212 </span>            :                    const FieldDescriptor* field) const;
<span class="lineNum">     213 </span>            :   string GetString(const Message&amp; message,
<span class="lineNum">     214 </span>            :                    const FieldDescriptor* field) const;
<span class="lineNum">     215 </span>            :   const string&amp; GetStringReference(const Message&amp; message,
<span class="lineNum">     216 </span>            :                                    const FieldDescriptor* field,
<span class="lineNum">     217 </span>            :                                    string* scratch) const;
<span class="lineNum">     218 </span>            :   const EnumValueDescriptor* GetEnum(const Message&amp; message,
<span class="lineNum">     219 </span>            :                                      const FieldDescriptor* field) const;
<span class="lineNum">     220 </span>            :   const Message&amp; GetMessage(const Message&amp; message,
<span class="lineNum">     221 </span>            :                             const FieldDescriptor* field,
<span class="lineNum">     222 </span>            :                             MessageFactory* factory = NULL) const;
<span class="lineNum">     223 </span>            : 
<span class="lineNum">     224 </span>            :   const FieldDescriptor* GetOneofFieldDescriptor(
<span class="lineNum">     225 </span>            :       const Message&amp; message,
<span class="lineNum">     226 </span>            :       const OneofDescriptor* oneof_descriptor) const;
<span class="lineNum">     227 </span>            : 
<span class="lineNum">     228 </span>            :  public:
<span class="lineNum">     229 </span>            :   void SetInt32 (Message* message,
<span class="lineNum">     230 </span>            :                  const FieldDescriptor* field, int32  value) const;
<span class="lineNum">     231 </span>            :   void SetInt64 (Message* message,
<span class="lineNum">     232 </span>            :                  const FieldDescriptor* field, int64  value) const;
<span class="lineNum">     233 </span>            :   void SetUInt32(Message* message,
<span class="lineNum">     234 </span>            :                  const FieldDescriptor* field, uint32 value) const;
<span class="lineNum">     235 </span>            :   void SetUInt64(Message* message,
<span class="lineNum">     236 </span>            :                  const FieldDescriptor* field, uint64 value) const;
<span class="lineNum">     237 </span>            :   void SetFloat (Message* message,
<span class="lineNum">     238 </span>            :                  const FieldDescriptor* field, float  value) const;
<span class="lineNum">     239 </span>            :   void SetDouble(Message* message,
<span class="lineNum">     240 </span>            :                  const FieldDescriptor* field, double value) const;
<span class="lineNum">     241 </span>            :   void SetBool  (Message* message,
<span class="lineNum">     242 </span>            :                  const FieldDescriptor* field, bool   value) const;
<span class="lineNum">     243 </span>            :   void SetString(Message* message,
<span class="lineNum">     244 </span>            :                  const FieldDescriptor* field,
<span class="lineNum">     245 </span>            :                  const string&amp; value) const;
<span class="lineNum">     246 </span>            :   void SetEnum  (Message* message, const FieldDescriptor* field,
<span class="lineNum">     247 </span>            :                  const EnumValueDescriptor* value) const;
<span class="lineNum">     248 </span>            :   Message* MutableMessage(Message* message, const FieldDescriptor* field,
<span class="lineNum">     249 </span>            :                           MessageFactory* factory = NULL) const;
<span class="lineNum">     250 </span>            :   void SetAllocatedMessage(Message* message,
<span class="lineNum">     251 </span>            :                            Message* sub_message,
<span class="lineNum">     252 </span>            :                            const FieldDescriptor* field) const;
<span class="lineNum">     253 </span>            :   Message* ReleaseMessage(Message* message, const FieldDescriptor* field,
<span class="lineNum">     254 </span>            :                           MessageFactory* factory = NULL) const;
<span class="lineNum">     255 </span>            : 
<span class="lineNum">     256 </span>            :   int32  GetRepeatedInt32 (const Message&amp; message,
<span class="lineNum">     257 </span>            :                            const FieldDescriptor* field, int index) const;
<span class="lineNum">     258 </span>            :   int64  GetRepeatedInt64 (const Message&amp; message,
<span class="lineNum">     259 </span>            :                            const FieldDescriptor* field, int index) const;
<span class="lineNum">     260 </span>            :   uint32 GetRepeatedUInt32(const Message&amp; message,
<span class="lineNum">     261 </span>            :                            const FieldDescriptor* field, int index) const;
<span class="lineNum">     262 </span>            :   uint64 GetRepeatedUInt64(const Message&amp; message,
<span class="lineNum">     263 </span>            :                            const FieldDescriptor* field, int index) const;
<span class="lineNum">     264 </span>            :   float  GetRepeatedFloat (const Message&amp; message,
<span class="lineNum">     265 </span>            :                            const FieldDescriptor* field, int index) const;
<span class="lineNum">     266 </span>            :   double GetRepeatedDouble(const Message&amp; message,
<span class="lineNum">     267 </span>            :                            const FieldDescriptor* field, int index) const;
<span class="lineNum">     268 </span>            :   bool   GetRepeatedBool  (const Message&amp; message,
<span class="lineNum">     269 </span>            :                            const FieldDescriptor* field, int index) const;
<span class="lineNum">     270 </span>            :   string GetRepeatedString(const Message&amp; message,
<span class="lineNum">     271 </span>            :                            const FieldDescriptor* field, int index) const;
<span class="lineNum">     272 </span>            :   const string&amp; GetRepeatedStringReference(const Message&amp; message,
<span class="lineNum">     273 </span>            :                                            const FieldDescriptor* field,
<span class="lineNum">     274 </span>            :                                            int index, string* scratch) const;
<span class="lineNum">     275 </span>            :   const EnumValueDescriptor* GetRepeatedEnum(const Message&amp; message,
<span class="lineNum">     276 </span>            :                                              const FieldDescriptor* field,
<span class="lineNum">     277 </span>            :                                              int index) const;
<span class="lineNum">     278 </span>            :   const Message&amp; GetRepeatedMessage(const Message&amp; message,
<span class="lineNum">     279 </span>            :                                     const FieldDescriptor* field,
<span class="lineNum">     280 </span>            :                                     int index) const;
<span class="lineNum">     281 </span>            : 
<span class="lineNum">     282 </span>            :   // Set the value of a field.
<span class="lineNum">     283 </span>            :   void SetRepeatedInt32 (Message* message,
<span class="lineNum">     284 </span>            :                          const FieldDescriptor* field, int index, int32  value) const;
<span class="lineNum">     285 </span>            :   void SetRepeatedInt64 (Message* message,
<span class="lineNum">     286 </span>            :                          const FieldDescriptor* field, int index, int64  value) const;
<span class="lineNum">     287 </span>            :   void SetRepeatedUInt32(Message* message,
<span class="lineNum">     288 </span>            :                          const FieldDescriptor* field, int index, uint32 value) const;
<span class="lineNum">     289 </span>            :   void SetRepeatedUInt64(Message* message,
<span class="lineNum">     290 </span>            :                          const FieldDescriptor* field, int index, uint64 value) const;
<span class="lineNum">     291 </span>            :   void SetRepeatedFloat (Message* message,
<span class="lineNum">     292 </span>            :                          const FieldDescriptor* field, int index, float  value) const;
<span class="lineNum">     293 </span>            :   void SetRepeatedDouble(Message* message,
<span class="lineNum">     294 </span>            :                          const FieldDescriptor* field, int index, double value) const;
<span class="lineNum">     295 </span>            :   void SetRepeatedBool  (Message* message,
<span class="lineNum">     296 </span>            :                          const FieldDescriptor* field, int index, bool   value) const;
<span class="lineNum">     297 </span>            :   void SetRepeatedString(Message* message,
<span class="lineNum">     298 </span>            :                          const FieldDescriptor* field, int index,
<span class="lineNum">     299 </span>            :                          const string&amp; value) const;
<span class="lineNum">     300 </span>            :   void SetRepeatedEnum(Message* message, const FieldDescriptor* field,
<span class="lineNum">     301 </span>            :                        int index, const EnumValueDescriptor* value) const;
<span class="lineNum">     302 </span>            :   // Get a mutable pointer to a field with a message type.
<span class="lineNum">     303 </span>            :   Message* MutableRepeatedMessage(Message* message,
<span class="lineNum">     304 </span>            :                                   const FieldDescriptor* field,
<span class="lineNum">     305 </span>            :                                   int index) const;
<span class="lineNum">     306 </span>            : 
<span class="lineNum">     307 </span>            :   void AddInt32 (Message* message,
<span class="lineNum">     308 </span>            :                  const FieldDescriptor* field, int32  value) const;
<span class="lineNum">     309 </span>            :   void AddInt64 (Message* message,
<span class="lineNum">     310 </span>            :                  const FieldDescriptor* field, int64  value) const;
<span class="lineNum">     311 </span>            :   void AddUInt32(Message* message,
<span class="lineNum">     312 </span>            :                  const FieldDescriptor* field, uint32 value) const;
<span class="lineNum">     313 </span>            :   void AddUInt64(Message* message,
<span class="lineNum">     314 </span>            :                  const FieldDescriptor* field, uint64 value) const;
<span class="lineNum">     315 </span>            :   void AddFloat (Message* message,
<span class="lineNum">     316 </span>            :                  const FieldDescriptor* field, float  value) const;
<span class="lineNum">     317 </span>            :   void AddDouble(Message* message,
<span class="lineNum">     318 </span>            :                  const FieldDescriptor* field, double value) const;
<span class="lineNum">     319 </span>            :   void AddBool  (Message* message,
<span class="lineNum">     320 </span>            :                  const FieldDescriptor* field, bool   value) const;
<span class="lineNum">     321 </span>            :   void AddString(Message* message,
<span class="lineNum">     322 </span>            :                  const FieldDescriptor* field, const string&amp; value) const;
<span class="lineNum">     323 </span>            :   void AddEnum(Message* message,
<span class="lineNum">     324 </span>            :                const FieldDescriptor* field,
<span class="lineNum">     325 </span>            :                const EnumValueDescriptor* value) const;
<span class="lineNum">     326 </span>            :   Message* AddMessage(Message* message, const FieldDescriptor* field,
<span class="lineNum">     327 </span>            :                       MessageFactory* factory = NULL) const;
<span class="lineNum">     328 </span>            : 
<span class="lineNum">     329 </span>            :   const FieldDescriptor* FindKnownExtensionByName(const string&amp; name) const;
<span class="lineNum">     330 </span>            :   const FieldDescriptor* FindKnownExtensionByNumber(int number) const;
<span class="lineNum">     331 </span>            : 
<span class="lineNum">     332 </span>            :  protected:
<span class="lineNum">     333 </span>            :   virtual void* MutableRawRepeatedField(
<span class="lineNum">     334 </span>            :       Message* message, const FieldDescriptor* field, FieldDescriptor::CppType,
<span class="lineNum">     335 </span>            :       int ctype, const Descriptor* desc) const;
<span class="lineNum">     336 </span>            : 
<span class="lineNum">     337 </span>            :  private:
<span class="lineNum">     338 </span>            :   friend class GeneratedMessage;
<span class="lineNum">     339 </span>            : 
<span class="lineNum">     340 </span>            :   // To parse directly into a proto2 generated class, the class GMR_Handlers
<span class="lineNum">     341 </span>            :   // needs access to member offsets and hasbits.
<span class="lineNum">     342 </span>            :   friend class LIBPROTOBUF_EXPORT upb::google_opensource::GMR_Handlers;
<span class="lineNum">     343 </span>            : 
<span class="lineNum">     344 </span>            :   const Descriptor* descriptor_;
<span class="lineNum">     345 </span>            :   const Message* default_instance_;
<span class="lineNum">     346 </span>            :   const void* default_oneof_instance_;
<span class="lineNum">     347 </span>            :   const int* offsets_;
<span class="lineNum">     348 </span>            : 
<span class="lineNum">     349 </span>            :   int has_bits_offset_;
<span class="lineNum">     350 </span>            :   int oneof_case_offset_;
<span class="lineNum">     351 </span>            :   int unknown_fields_offset_;
<span class="lineNum">     352 </span>            :   int extensions_offset_;
<span class="lineNum">     353 </span>            :   int object_size_;
<span class="lineNum">     354 </span>            : 
<span class="lineNum">     355 </span>            :   const DescriptorPool* descriptor_pool_;
<span class="lineNum">     356 </span>            :   MessageFactory* message_factory_;
<span class="lineNum">     357 </span>            : 
<span class="lineNum">     358 </span>            :   template &lt;typename Type&gt;
<span class="lineNum">     359 </span>            :   inline const Type&amp; GetRaw(const Message&amp; message,
<span class="lineNum">     360 </span>            :                             const FieldDescriptor* field) const;
<span class="lineNum">     361 </span>            :   template &lt;typename Type&gt;
<span class="lineNum">     362 </span>            :   inline Type* MutableRaw(Message* message,
<span class="lineNum">     363 </span>            :                           const FieldDescriptor* field) const;
<span class="lineNum">     364 </span>            :   template &lt;typename Type&gt;
<span class="lineNum">     365 </span>            :   inline const Type&amp; DefaultRaw(const FieldDescriptor* field) const;
<span class="lineNum">     366 </span>            :   template &lt;typename Type&gt;
<span class="lineNum">     367 </span>            :   inline const Type&amp; DefaultOneofRaw(const FieldDescriptor* field) const;
<span class="lineNum">     368 </span>            : 
<span class="lineNum">     369 </span>            :   inline const uint32* GetHasBits(const Message&amp; message) const;
<span class="lineNum">     370 </span>            :   inline uint32* MutableHasBits(Message* message) const;
<span class="lineNum">     371 </span>            :   inline uint32 GetOneofCase(
<span class="lineNum">     372 </span>            :       const Message&amp; message,
<span class="lineNum">     373 </span>            :       const OneofDescriptor* oneof_descriptor) const;
<span class="lineNum">     374 </span>            :   inline uint32* MutableOneofCase(
<span class="lineNum">     375 </span>            :       Message* message,
<span class="lineNum">     376 </span>            :       const OneofDescriptor* oneof_descriptor) const;
<span class="lineNum">     377 </span>            :   inline const ExtensionSet&amp; GetExtensionSet(const Message&amp; message) const;
<span class="lineNum">     378 </span>            :   inline ExtensionSet* MutableExtensionSet(Message* message) const;
<span class="lineNum">     379 </span>            : 
<span class="lineNum">     380 </span>            :   inline bool HasBit(const Message&amp; message,
<span class="lineNum">     381 </span>            :                      const FieldDescriptor* field) const;
<span class="lineNum">     382 </span>            :   inline void SetBit(Message* message,
<span class="lineNum">     383 </span>            :                      const FieldDescriptor* field) const;
<span class="lineNum">     384 </span>            :   inline void ClearBit(Message* message,
<span class="lineNum">     385 </span>            :                        const FieldDescriptor* field) const;
<span class="lineNum">     386 </span>            :   inline void SwapBit(Message* message1,
<span class="lineNum">     387 </span>            :                       Message* message2,
<span class="lineNum">     388 </span>            :                       const FieldDescriptor* field) const;
<span class="lineNum">     389 </span>            : 
<span class="lineNum">     390 </span>            :   // This function only swaps the field. Should swap corresponding has_bit
<span class="lineNum">     391 </span>            :   // before or after using this function.
<span class="lineNum">     392 </span>            :   void SwapField(Message* message1,
<span class="lineNum">     393 </span>            :                  Message* message2,
<span class="lineNum">     394 </span>            :                  const FieldDescriptor* field) const;
<span class="lineNum">     395 </span>            : 
<span class="lineNum">     396 </span>            :   void SwapOneofField(Message* message1,
<span class="lineNum">     397 </span>            :                       Message* message2,
<span class="lineNum">     398 </span>            :                       const OneofDescriptor* oneof_descriptor) const;
<span class="lineNum">     399 </span>            : 
<span class="lineNum">     400 </span>            :   inline bool HasOneofField(const Message&amp; message,
<span class="lineNum">     401 </span>            :                             const FieldDescriptor* field) const;
<span class="lineNum">     402 </span>            :   inline void SetOneofCase(Message* message,
<span class="lineNum">     403 </span>            :                            const FieldDescriptor* field) const;
<span class="lineNum">     404 </span>            :   inline void ClearOneofField(Message* message,
<span class="lineNum">     405 </span>            :                               const FieldDescriptor* field) const;
<span class="lineNum">     406 </span>            : 
<span class="lineNum">     407 </span>            :   template &lt;typename Type&gt;
<span class="lineNum">     408 </span>            :   inline const Type&amp; GetField(const Message&amp; message,
<span class="lineNum">     409 </span>            :                               const FieldDescriptor* field) const;
<span class="lineNum">     410 </span>            :   template &lt;typename Type&gt;
<span class="lineNum">     411 </span>            :   inline void SetField(Message* message,
<span class="lineNum">     412 </span>            :                        const FieldDescriptor* field, const Type&amp; value) const;
<span class="lineNum">     413 </span>            :   template &lt;typename Type&gt;
<span class="lineNum">     414 </span>            :   inline Type* MutableField(Message* message,
<span class="lineNum">     415 </span>            :                             const FieldDescriptor* field) const;
<span class="lineNum">     416 </span>            :   template &lt;typename Type&gt;
<span class="lineNum">     417 </span>            :   inline const Type&amp; GetRepeatedField(const Message&amp; message,
<span class="lineNum">     418 </span>            :                                       const FieldDescriptor* field,
<span class="lineNum">     419 </span>            :                                       int index) const;
<span class="lineNum">     420 </span>            :   template &lt;typename Type&gt;
<span class="lineNum">     421 </span>            :   inline const Type&amp; GetRepeatedPtrField(const Message&amp; message,
<span class="lineNum">     422 </span>            :                                          const FieldDescriptor* field,
<span class="lineNum">     423 </span>            :                                          int index) const;
<span class="lineNum">     424 </span>            :   template &lt;typename Type&gt;
<span class="lineNum">     425 </span>            :   inline void SetRepeatedField(Message* message,
<span class="lineNum">     426 </span>            :                                const FieldDescriptor* field, int index,
<span class="lineNum">     427 </span>            :                                Type value) const;
<span class="lineNum">     428 </span>            :   template &lt;typename Type&gt;
<span class="lineNum">     429 </span>            :   inline Type* MutableRepeatedField(Message* message,
<span class="lineNum">     430 </span>            :                                     const FieldDescriptor* field,
<span class="lineNum">     431 </span>            :                                     int index) const;
<span class="lineNum">     432 </span>            :   template &lt;typename Type&gt;
<span class="lineNum">     433 </span>            :   inline void AddField(Message* message,
<span class="lineNum">     434 </span>            :                        const FieldDescriptor* field, const Type&amp; value) const;
<span class="lineNum">     435 </span>            :   template &lt;typename Type&gt;
<span class="lineNum">     436 </span>            :   inline Type* AddField(Message* message,
<span class="lineNum">     437 </span>            :                         const FieldDescriptor* field) const;
<span class="lineNum">     438 </span>            : 
<span class="lineNum">     439 </span>            :   int GetExtensionNumberOrDie(const Descriptor* type) const;
<span class="lineNum">     440 </span>            : 
<span class="lineNum">     441 </span>            :   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(GeneratedMessageReflection);
<span class="lineNum">     442 </span>            : };
<span class="lineNum">     443 </span>            : 
<span class="lineNum">     444 </span>            : // Returns the offset of the given field within the given aggregate type.
<span class="lineNum">     445 </span>            : // This is equivalent to the ANSI C offsetof() macro.  However, according
<span class="lineNum">     446 </span>            : // to the C++ standard, offsetof() only works on POD types, and GCC
<span class="lineNum">     447 </span>            : // enforces this requirement with a warning.  In practice, this rule is
<span class="lineNum">     448 </span>            : // unnecessarily strict; there is probably no compiler or platform on
<span class="lineNum">     449 </span>            : // which the offsets of the direct fields of a class are non-constant.
<span class="lineNum">     450 </span>            : // Fields inherited from superclasses *can* have non-constant offsets,
<span class="lineNum">     451 </span>            : // but that's not what this macro will be used for.
<span class="lineNum">     452 </span>            : //
<span class="lineNum">     453 </span>            : // Note that we calculate relative to the pointer value 16 here since if we
<span class="lineNum">     454 </span>            : // just use zero, GCC complains about dereferencing a NULL pointer.  We
<span class="lineNum">     455 </span>            : // choose 16 rather than some other number just in case the compiler would
<span class="lineNum">     456 </span>            : // be confused by an unaligned pointer.
<span class="lineNum">     457 </span>            : #define GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TYPE, FIELD)    \
<span class="lineNum">     458 </span>            :   static_cast&lt;int&gt;(                                           \
<span class="lineNum">     459 </span>            :       reinterpret_cast&lt;const char*&gt;(                          \
<span class="lineNum">     460 </span>            :           &amp;reinterpret_cast&lt;const TYPE*&gt;(16)-&gt;FIELD) -        \
<span class="lineNum">     461 </span>            :       reinterpret_cast&lt;const char*&gt;(16))
<span class="lineNum">     462 </span>            : 
<span class="lineNum">     463 </span>            : #define PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(ONEOF, FIELD)     \
<span class="lineNum">     464 </span>            :   static_cast&lt;int&gt;(                                                   \
<span class="lineNum">     465 </span>            :       reinterpret_cast&lt;const char*&gt;(&amp;(ONEOF-&gt;FIELD))                  \
<span class="lineNum">     466 </span>            :       - reinterpret_cast&lt;const char*&gt;(ONEOF))
<span class="lineNum">     467 </span>            : 
<span class="lineNum">     468 </span>            : // There are some places in proto2 where dynamic_cast would be useful as an
<span class="lineNum">     469 </span>            : // optimization.  For example, take Message::MergeFrom(const Message&amp; other).
<span class="lineNum">     470 </span>            : // For a given generated message FooMessage, we generate these two methods:
<span class="lineNum">     471 </span>            : //   void MergeFrom(const FooMessage&amp; other);
<span class="lineNum">     472 </span>            : //   void MergeFrom(const Message&amp; other);
<span class="lineNum">     473 </span>            : // The former method can be implemented directly in terms of FooMessage's
<span class="lineNum">     474 </span>            : // inline accessors, but the latter method must work with the reflection
<span class="lineNum">     475 </span>            : // interface.  However, if the parameter to the latter method is actually of
<span class="lineNum">     476 </span>            : // type FooMessage, then we'd like to be able to just call the other method
<span class="lineNum">     477 </span>            : // as an optimization.  So, we use dynamic_cast to check this.
<span class="lineNum">     478 </span>            : //
<span class="lineNum">     479 </span>            : // That said, dynamic_cast requires RTTI, which many people like to disable
<span class="lineNum">     480 </span>            : // for performance and code size reasons.  When RTTI is not available, we
<span class="lineNum">     481 </span>            : // still need to produce correct results.  So, in this case we have to fall
<span class="lineNum">     482 </span>            : // back to using reflection, which is what we would have done anyway if the
<span class="lineNum">     483 </span>            : // objects were not of the exact same class.
<span class="lineNum">     484 </span>            : //
<span class="lineNum">     485 </span>            : // dynamic_cast_if_available() implements this logic.  If RTTI is
<span class="lineNum">     486 </span>            : // enabled, it does a dynamic_cast.  If RTTI is disabled, it just returns
<span class="lineNum">     487 </span>            : // NULL.
<span class="lineNum">     488 </span>            : //
<span class="lineNum">     489 </span>            : // If you need to compile without RTTI, simply #define GOOGLE_PROTOBUF_NO_RTTI.
<span class="lineNum">     490 </span>            : // On MSVC, this should be detected automatically.
<span class="lineNum">     491 </span>            : template&lt;typename To, typename From&gt;
<span class="lineNum">     492 </span>            : inline To dynamic_cast_if_available(From from) {
<span class="lineNum">     493 </span>            : #if defined(GOOGLE_PROTOBUF_NO_RTTI) || (defined(_MSC_VER)&amp;&amp;!defined(_CPPRTTI))
<span class="lineNum">     494 </span>            :   return NULL;
<span class="lineNum">     495 </span>            : #else
<span class="lineNum">     496 </span><span class="lineNoCov">          0 :   return dynamic_cast&lt;To&gt;(from);</span>
<span class="lineNum">     497 </span>            : #endif
<span class="lineNum">     498 </span>            : }
<span class="lineNum">     499 </span>            : 
<span class="lineNum">     500 </span>            : }  // namespace internal
<span class="lineNum">     501 </span>            : }  // namespace protobuf
<span class="lineNum">     502 </span>            : 
<span class="lineNum">     503 </span>            : }  // namespace google
<span class="lineNum">     504 </span>            : #endif  // GOOGLE_PROTOBUF_GENERATED_MESSAGE_REFLECTION_H__
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.12</a></td></tr>
  </table>
  <br>

</body>
</html>
